package com.num2.service.scf;

import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;

import com.num2.dao.scf.ITransaction_recordDao;
import com.num2.form.scf.Transaction_recordForm;
import com.num2.model.scf.Transaction_recordModel;



@Service
public class Transaction_recordService {
	@Resource
	private SqlSessionFactory sqlSessionFactory;
	 public Transaction_recordModel check(Transaction_recordForm transaction_recordForm){
	        //打开session
	        SqlSession sqlSession = sqlSessionFactory.openSession();
	        //通过 注解 获取 接口实现类的对象
	        ITransaction_recordDao transaction_recordDao = sqlSession.getMapper(ITransaction_recordDao.class);
	        //获取结果
	        List<Transaction_recordModel> transaction_recordModel = transaction_recordDao.check(transaction_recordForm);
	        //关闭会话
	        sqlSession.close();
	        if (transaction_recordModel.size() > 0)
	            return transaction_recordModel.get(0);
	        else
	            return null;
	    }

	    public SqlSessionFactory getSqlSessionFactory() {
	        return sqlSessionFactory;
	    }

	    public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
	        this.sqlSessionFactory = sqlSessionFactory;
	    }
	}


